package thread;

class DaemonThread implements Runnable {
	public void run() {
		for (int i = 0; true; i++) {
			System.out.println(Thread.currentThread().getName() + " " + i);
		}
	}

	public static void main(String[] args) throws InterruptedException {
		DaemonThread st = new DaemonThread();
		Thread s2=new Thread(st,"thread");
		s2.setDaemon(true);
		s2.start();
		s2.sleep(10);
		for (int i = 0; i < 50; i++) {
			System.out.println(Thread.currentThread().getName() + " " + i);
			if (i==20) {
				System.exit(0);
			}
		}
	}
}